package magazzino.utils;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class DataLoader {

	private String vettura;
	List<String> stocks = new ArrayList<String>();

	public DataLoader(String filename) {
		this.vettura = filename;

		try {

			BufferedReader reader = new BufferedReader(new java.io.FileReader(
					new File("vetture/" + filename + ".txt")));

			String line = reader.readLine();
			

			while (line != null) {

				stocks.add(line);
				//System.out.println(stocks);
				
				line = reader.readLine();

			}

			reader.close();

		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

	public List<String> getStocks() {
		return this.stocks;
	}
	
	public String getVettura(){
		return vettura;
	}

}
